package com.cli.springbootstaterdemo.service;

import com.cli.springboot_stater.spi.IShout;
import org.springframework.stereotype.Service;

import java.util.ServiceLoader;

/**
 * @author mir.xiong
 * @version 1.0
 * @description
 * @see
 * @since Created by work on 2022/5/1 18:33
 */
@Service
public class SpiTestService {

    public void spiTest() {
        ServiceLoader<IShout> iShouts = ServiceLoader.load(IShout.class);
        for (IShout iShout : iShouts) {
            iShout.shout();
        }
    }
}
